package com.etc.doctor.controller;

import com.etc.common.entity.BasicDoctor;
import com.etc.common.utils.Result;
import com.etc.doctor.service.BasicDoctorService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/doc")
public class BasicDoctorController {

    @Resource
    private BasicDoctorService basicDoctorService;

    /**
     * 查询医生工作统计
     *
     * @param docId
     * @return
     */
    @GetMapping("/queryData")
    public Result queryData(@RequestParam("docId")String docId) {
        return basicDoctorService.queryData(docId);
    }

    /**
     * 查询医生列表
     *
     * @return
     */
    @GetMapping("/queryAll")
    public Result queryAll(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize")Integer pageSize) {
        System.out.println("pageNum: " + pageNum + ", pageSize: " + pageSize);
        return basicDoctorService.queryAll(pageNum, pageSize);
    }

    /**
     * 修改医生信息
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public Result update(@RequestBody BasicDoctor doctor) {
        return basicDoctorService.update(doctor);
    }

    /**
     * 注销医生
     *
     */
    @RequestMapping(value = "/updateStatus",method = RequestMethod.POST)
    public Result updateStatus(@RequestParam("docId") String docId) {
        return basicDoctorService.updateStatus(docId);
    }
}
